//
//  ShenQingBuZhuJinInfoCell.m
//  FactorySale
//
//  Created by 李 on 2020/3/26.
//  Copyright © 2020 主事丫环. All rights reserved.
//

#import "ShenQingBuZhuJinInfoCell.h"
#import "SYBigImage.h"

@interface ShenQingBuZhuJinInfoCell ()

@property(nonatomic,strong) UILabel *guZhangMiaoShuLab;
@property(nonatomic,strong)UILabel *pingZhengWordLab;

@end
@implementation ShenQingBuZhuJinInfoCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        
        //申请补助金信息  文字
        UIImageView *infoImage = [[UIImageView alloc]initWithFrame:CGRectMake(20, 11, 4, 15)];
        infoImage.image = [UIImage imageNamed:@"圆角矩形 22"];
        [self.contentView addSubview:infoImage];
        
        UILabel *infoLab = [[UILabel alloc]initWithFrame:CGRectMake(36, 12, 100, 14)];
        infoLab.font = FontSize(14);
        infoLab.textColor = [UIColor colorWithHexString:@"#333333"];
        infoLab.text = @"申请补助金信息";
        [self.contentView addSubview:infoLab];
        
        UIView * line = [[UIView alloc] initWithFrame:CGRectMake(15, infoLab.bottom+5, ScreenW-20, 0.5)];
        line.backgroundColor = Main_BackGroundColor;
        [self.contentView addSubview:line];
        // 故障描述：
        UILabel *guZhangMiaoShuWordLab = [[UILabel alloc] init];
        guZhangMiaoShuWordLab.frame = CGRectMake(39, 45, 12*5, 12);
        guZhangMiaoShuWordLab.font = KFontPingFangSCRegular(12);
        guZhangMiaoShuWordLab.textColor = K333333;
        guZhangMiaoShuWordLab.text = @"故障描述：";
        [self.contentView addSubview:guZhangMiaoShuWordLab];
        
        UILabel *guZhangMiaoShuLab = [[UILabel alloc] init];
        guZhangMiaoShuLab.frame = CGRectMake(guZhangMiaoShuWordLab.right, 45, KWIDTH-39-14*5, 12);
        guZhangMiaoShuLab.font = KFontPingFangSCRegular(12);
        guZhangMiaoShuLab.textColor = K666666;
        guZhangMiaoShuLab.text = @"";
        [self.contentView addSubview:guZhangMiaoShuLab];
        self.guZhangMiaoShuLab =guZhangMiaoShuLab;
        
        
        //故障凭证
        UILabel *pingZhengWordLab = [[UILabel alloc] init];
        pingZhengWordLab.frame = CGRectMake(39, guZhangMiaoShuWordLab.bottom+15, KWIDTH-39, 12);
        pingZhengWordLab.font = KFontPingFangSCRegular(12);
        pingZhengWordLab.textColor = K333333;
        pingZhengWordLab.text = @"故障产品凭证";
        [self.contentView addSubview:pingZhengWordLab];
        self.pingZhengWordLab = pingZhengWordLab;
        
        
    }
    return self;
}
-(void)setModel:(GrantDetailContentModel *)model
{
    _model =model;
    if (_model) {
        self.guZhangMiaoShuLab.text = model.faultDetails;
        
        //照片背景 View
        UIView *imageBackView = [[UIView alloc] init];
        imageBackView.frame = CGRectMake(32.5, self.pingZhengWordLab.bottom + 5, KWIDTH-65, 75);
        [self.contentView addSubview:imageBackView];
        self.imageBackView = imageBackView;

        NSString *imagesStr = self.model.faultImg;
        NSArray *imagearr = [imagesStr componentsSeparatedByString:@"|"];
        CGFloat wei = (KWIDTH-25-46-46)/4;

        if (imagearr.count > 0) {
            [self.imageBackView removeAllSubviews];
            for (int i = 0; i < imagearr.count; i++) {
                UIImageView *myimage = [[UIImageView alloc]init];
                [self.imageBackView addSubview:myimage];
                [myimage sd_setImageWithURL:[NSURL URLWithString:imagearr[i]] placeholderImage:defaultImg];
                myimage.frame = CGRectMake((wei+10)*(i % 4)+10, (wei + 10) * (i / 4)+5, wei, wei);
                myimage.userInteractionEnabled = YES;
                SYBigImage * bigI = [[SYBigImage alloc]init];
                [myimage addGestureRecognizer:bigI];
                self.imageBackView.frame = CGRectMake(32.5, self.pingZhengWordLab.bottom + 5, self.contentView.width - 65, (wei + 10) * (i / 4 + 1));
            }
        }
    }
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

@end
